-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implmentation of Unittest cases (#466)
* Implmentation of Unittest cases * Minor debugging * Corrections * Minor corrections on feedback
- Loading branch information
1 parent
41b222e
commit 1176170
Showing
16 changed files
with
573 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from migrations.seeders.user import * | ||
from migrations.seeders.system_phone import * | ||
from migrations.seeders.partner import * | ||
from migrations.seeders.registration import * | ||
from migrations.seeders.program import * | ||
from migrations.seeders.language import * | ||
from migrations.seeders.content_version import * | ||
from migrations.seeders.content import * | ||
from migrations.seeders.user_program import * | ||
from migrations.seeders.module import * | ||
from migrations.seeders.module_content import * | ||
from migrations.seeders.program_module import * | ||
from migrations.seeders.program_sequence import * | ||
from migrations.seeders.call_log import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from faker import Faker | ||
from uuid import uuid4 | ||
from api.models import CallLog as CallLogInstance | ||
from api import db | ||
|
||
|
||
class CallLog: | ||
faker = Faker() # Kept for future use | ||
|
||
def create_call_log(self, phone_number, content_id, content_version_id): | ||
call_log_record = CallLogInstance() | ||
call_log_record.user_phone_number = phone_number | ||
call_log_record.content_id = content_id | ||
call_log_record.content_version_id = content_version_id | ||
call_log_record.flow_run_uuid = str(uuid4()) | ||
|
||
db.session.add(call_log_record) | ||
db.session.commit() | ||
|
||
|
||
if __name__ == "__main__": | ||
seeder = CallLog() | ||
seeder.create_call_log( | ||
phone_number="1234567890", content_id=1, content_version_id=1 | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import datetime | ||
from faker import Faker | ||
from api.models import Module as ModuleInstance | ||
from api import db | ||
|
||
|
||
class Module: | ||
faker = Faker() # Kept for future use | ||
|
||
def create_module(self, program_id): | ||
module_instance = ModuleInstance() | ||
module_instance.name = "Test Module" | ||
module_instance.program_id = program_id | ||
|
||
db.session.add(module_instance) | ||
db.session.commit() | ||
|
||
return module_instance | ||
|
||
|
||
if __name__ == "__main__": | ||
seeder = Module() | ||
seeder.create_module(program_id=1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import datetime | ||
from faker import Faker | ||
from api.models import ModuleContent as ModuleContentInstance | ||
from api import db | ||
|
||
|
||
class ModuleContent: | ||
faker = Faker() # Kept for future use | ||
|
||
def create_module_content(self, module_id, content_id): | ||
module_instance = ModuleContentInstance() | ||
module_instance.module_id = module_id | ||
module_instance.content_id = content_id | ||
|
||
db.session.add(module_instance) | ||
db.session.commit() | ||
|
||
return module_instance | ||
|
||
|
||
if __name__ == "__main__": | ||
seeder = ModuleContent() | ||
seeder.create_module_content(module_id=1, content_id=1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import datetime | ||
from faker import Faker | ||
from api.models import ProgramModule as ProgramModuleInstance | ||
from api import db | ||
|
||
|
||
class ProgramModule: | ||
faker = Faker() # Kept for future use | ||
|
||
def create_program_module(self, program_id, module_id, sequence_id=1): | ||
program_module_instance = ProgramModuleInstance() | ||
program_module_instance.program_id = program_id | ||
program_module_instance.module_id = module_id | ||
program_module_instance.sequence = sequence_id | ||
|
||
db.session.add(program_module_instance) | ||
db.session.commit() | ||
|
||
return program_module_instance | ||
|
||
|
||
if __name__ == "__main__": | ||
seeder = ProgramModule() | ||
seeder.create_program_module(program_id=1, module_id=1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import datetime | ||
from faker import Faker | ||
from api.models import ProgramSequence as ProgramSequenceInstance | ||
from api import db | ||
|
||
|
||
class ProgramSequence: | ||
faker = Faker() # Kept for future use | ||
|
||
def create_program_sequence(self, content_id, program_id, module_id): | ||
program_sequence_instance = ProgramSequenceInstance() | ||
program_sequence_instance.program_id = program_id | ||
program_sequence_instance.content_id = content_id | ||
program_sequence_instance.module_id = module_id | ||
|
||
db.session.add(program_sequence_instance) | ||
db.session.commit() | ||
|
||
return program_sequence_instance | ||
|
||
|
||
if __name__ == "__main__": | ||
seeder = ProgramSequence() | ||
seeder.create_program_sequence(program_id=1, content_id=1, module_id=1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
1176170
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.