Skip to content

Commit d6aebca

Browse files
Merge branch 'main' into dev
Signed-off-by: Deepak Raj <[email protected]>
2 parents fe254e3 + d99077c commit d6aebca

File tree

9 files changed

+153
-2
lines changed

9 files changed

+153
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ All notable changes to this project will be documented in this file. The format
2626

2727
- [x] Updating API Documentation
2828
- [x] Bug fixes
29+
- [x] Get Gender Specific Data
2930

3031
## [V3.0.1] - Minor Release - 18-11-2022
3132

CONTRIBUTING.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ We love your input! We want to make contributing to this project as easy and tra
5050

5151
- Create a PR from our repo on Github.
5252

53+
### Run Flake8
54+
55+
```sh
56+
flake8 . --isolated --ignore=E501,E402
57+
```
58+
5359
### Additional Notes
5460

5561
- Any changes should be made in the `dev` branch.

docs/assets/sample.png

120 KB
Loading

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ Other Projects by Py-Contributors:
6161
installation.rst
6262
command_line_usage.rst
6363
import_as_module.rst
64+
run_as_server.rst
6465
changelog.rst
6566
roadmap.rst
6667
run_test_cases.rst

docs/introduction.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Use cases
1111
- Mocking classes
1212
- Populating databases
1313
- Generating test data
14-
- Generating fake data for your application
14+
- Generating fake data for Cybersecurity
1515
- Generating fake data for your tests
1616
- Generating fake data for your documentation
1717
- Generating fake data for your presentation

docs/run_as_server.rst

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
Run as server
2+
=============
3+
4+
To run as a server, you need to specify the port to listen on:
5+
6+
7+
.. code-block:: bash
8+
9+
default port is 8000
10+
$ rp --server --port 8080
11+
12+
This will start a server on port 8080. You can then use the client to connect to it:
13+
14+
Test it with postman
15+
16+
.. code-block:: bash
17+
18+
$ curl -X GET http://localhost:8080/ -H 'Content-Type: application/json'
19+
20+
Interactive Api Documentation
21+
22+
`http://localhost:<port>/docs`
23+
24+
API Endpoints
25+
-------------
26+
27+
`localhost:8000/api/v1/random_profile/full_profile?num=10`
28+
`localhost:8000/api/v1/random_profile/first_name?num=10`
29+
`localhost:8000/api/v1/random_profile/last_name?num=10`
30+
`localhost:8000/api/v1/random_profile/full_name?num=10`

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
fastapi
22
uvicorn
3-
pytest
3+
pytest

tests/__init__.py

Whitespace-only changes.

tests/test_package.py

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
import unittest
2+
import sys
3+
4+
sys.path.append('.')
5+
from typing import List, Tuple
6+
from random_profile import RandomProfile
7+
random_profile = RandomProfile(num=1)
8+
9+
10+
class RandomProfileTest(unittest.TestCase):
11+
# ----------------------------------------------------------------- #
12+
def test_fname_instance(self):
13+
self.assertIsInstance(random_profile.first_name(), str)
14+
15+
def test_faname_with_num(self):
16+
self.assertEqual(len(RandomProfile(num=10).first_name()), 10)
17+
18+
def test_fname_with_num_instance(self):
19+
self.assertIsInstance(RandomProfile(num=10).first_name(), List)
20+
21+
# ----------------------------------------------------------------- #
22+
def test_lname_instance(self):
23+
self.assertIsInstance(random_profile.last_name(), str)
24+
25+
def test_lname_with_num(self):
26+
self.assertEqual(len(RandomProfile(num=10).last_name()), 10)
27+
28+
def test_lname_with_num_instance(self):
29+
self.assertIsInstance(RandomProfile(num=10).last_name(), List)
30+
31+
# ----------------------------------------------------------------- #
32+
def test_full_name_instance(self):
33+
self.assertIsInstance(random_profile.full_name(), str)
34+
35+
def test_full_name_with_num(self):
36+
self.assertEqual(len(RandomProfile(num=10).full_name()), 10)
37+
38+
def test_full_name_with_num_instance(self):
39+
self.assertIsInstance(RandomProfile(num=10).full_name(), List)
40+
41+
# ----------------------------------------------------------------- #
42+
def test_full_profile_instance(self):
43+
self.assertIsInstance(random_profile.full_profile(), List)
44+
45+
def test_full_profile_with_num(self):
46+
self.assertEqual(len(RandomProfile(num=10).full_profile()), 10)
47+
48+
def test_full_profile_with_num_instance(self):
49+
self.assertIsInstance(RandomProfile(num=10).full_profile(), List)
50+
51+
# ----------------------------------------------------------------- #
52+
def test_ipv4_instance(self):
53+
self.assertIsInstance(random_profile.ip_address(), str)
54+
55+
def test_ipv4_with_num(self):
56+
self.assertEqual(len(RandomProfile(num=10).ip_address()), 10)
57+
58+
def test_ipv4_with_num_instance(self):
59+
self.assertIsInstance(RandomProfile(num=10).ip_address(), List)
60+
61+
# ----------------------------------------------------------------- #
62+
def test_job_title_instance(self):
63+
self.assertIsInstance(random_profile.job_title(), str)
64+
65+
def test_job_title_with_num(self):
66+
self.assertEqual(len(RandomProfile(num=10).job_title()), 10)
67+
68+
def test_job_title_with_num_instance(self):
69+
self.assertIsInstance(RandomProfile(num=10).job_title(), List)
70+
71+
# ----------------------------------------------------------------- #
72+
def test_blood_type_instance(self):
73+
self.assertIsInstance(random_profile.blood_type(), str)
74+
75+
def test_blood_type_with_num(self):
76+
self.assertEqual(len(RandomProfile(num=10).blood_type()), 10)
77+
78+
def test_blood_type_with_num_instance(self):
79+
self.assertIsInstance(RandomProfile(num=10).blood_type(), List)
80+
81+
# ----------------------------------------------------------------- #
82+
def test_hair_color_instance(self):
83+
self.assertIsInstance(random_profile.hair_color(), str)
84+
85+
def test_hair_color_with_num(self):
86+
self.assertEqual(len(RandomProfile(num=10).hair_color()), 10)
87+
88+
def test_hair_color_with_num_instance(self):
89+
self.assertIsInstance(RandomProfile(num=10).hair_color(), List)
90+
91+
# ----------------------------------------------------------------- #
92+
def test_dob_age_instance(self):
93+
self.assertIsInstance(random_profile.dob_age(), Tuple)
94+
95+
def test_dob_age_with_num(self):
96+
self.assertEqual(len(RandomProfile(num=10).dob_age()), 10)
97+
98+
def test_dob_age_with_num_instance(self):
99+
self.assertIsInstance(RandomProfile(num=10).dob_age(), List)
100+
101+
# ----------------------------------------------------------------- #
102+
def test_address_instance(self):
103+
self.assertIsInstance(random_profile.generate_address(), List)
104+
105+
def test_address_with_num(self):
106+
self.assertEqual(len(RandomProfile(num=10).generate_address()), 10)
107+
108+
def test_address_with_num_instance(self):
109+
self.assertIsInstance(RandomProfile(num=10).generate_address(), List)
110+
111+
112+
if __name__ == "__main__":
113+
unittest.main()

0 commit comments

Comments
 (0)