tests for new task order endpoints, remove new workspace routes

This commit is contained in:
dandds
2018-12-18 13:22:54 -05:00
parent 9a12c14636
commit ad03b58dee
7 changed files with 97 additions and 87 deletions

View File

@@ -33,6 +33,23 @@ def random_service_branch():
return random_choice(data.SERVICE_BRANCHES)
def random_dod_id():
return "".join(random.choices(string.digits, k=10))
def random_future_date(year_min=1, year_max=5):
if year_min == year_max:
inc = year_min
else:
inc = random.randrange(year_min, year_max)
return datetime.date(
datetime.date.today().year + inc,
random.randrange(1, 12),
random.randrange(1, 28),
)
class Base(factory.alchemy.SQLAlchemyModelFactory):
@classmethod
def dictionary(cls, **attrs):
@@ -58,7 +75,7 @@ class UserFactory(Base):
first_name = factory.Faker("first_name")
last_name = factory.Faker("last_name")
atat_role = factory.SubFactory(RoleFactory)
dod_id = factory.LazyFunction(lambda: "".join(random.choices(string.digits, k=10)))
dod_id = factory.LazyFunction(random_dod_id)
phone_number = factory.LazyFunction(
lambda: "".join(random.choices(string.digits, k=10))
)
@@ -227,13 +244,7 @@ class LegacyTaskOrderFactory(Base):
number = factory.LazyFunction(
lambda: "".join(random.choices(string.ascii_uppercase + string.digits, k=13))
)
expiration_date = factory.LazyFunction(
lambda: datetime.date(
datetime.date.today().year + random.randrange(1, 5),
random.randrange(1, 12),
random.randrange(1, 28),
)
)
expiration_date = factory.LazyFunction(random_future_date)
clin_0001 = random.randrange(100, 100_000)
clin_0003 = random.randrange(100, 100_000)
clin_1001 = random.randrange(100, 100_000)
@@ -358,10 +369,29 @@ class TaskOrderFactory(Base):
clin_01 = random.randrange(100, 100_000)
clin_03 = random.randrange(100, 100_000)
clin_02 = random.randrange(100, 100_000)
clin_04 = random.randrange(100, 100_000)
defense_component = random_service_branch()
defense_component = factory.LazyFunction(random_service_branch)
app_migration = random_choice(data.APP_MIGRATION)
native_apps = "no"
native_apps = random.choices(["yes", "no", "not_sure"])
complexity = random_choice(data.PROJECT_COMPLEXITY)
dev_team = random_choice(data.DEV_TEAM)
team_experience = random_choice(data.TEAM_EXPERIENCE)
scope = factory.Faker("sentence")
start_date = random_future_date(year_min=1, year_max=1)
end_date = random_future_date(year_min=2, year_max=5)
ko_first_name = factory.Faker("first_name")
ko_last_name = factory.Faker("last_name")
ko_email = factory.Faker("email")
ko_dod_id = factory.LazyFunction(random_dod_id)
cor_first_name = factory.Faker("first_name")
cor_last_name = factory.Faker("last_name")
cor_email = factory.Faker("email")
cor_dod_id = factory.LazyFunction(random_dod_id)
so_first_name = factory.Faker("first_name")
so_last_name = factory.Faker("last_name")
so_email = factory.Faker("email")
so_dod_id = factory.LazyFunction(random_dod_id)