def setUp(self): self.maxDiff = None user_details = { 'username': '******', 'password': '******', } self.user = User.objects.create_superuser(email='*****@*****.**', **user_details) self.org, _, _ = create_organization(self.user) self.assessment_factory = FakeGreenAssessmentFactory( organization=self.org) self.green_assessment = self.assessment_factory.get_green_assessment( name="Green Test Score", award_body="Green TS Inc", recognition_type=GreenAssessment.SCORE, validity_duration=(365 * 5)) self.url_factory = FakeGreenAssessmentURLFactory() self.gap_factory = FakeGreenAssessmentPropertyFactory( organization=self.org, user=self.user) self.start_date = datetime.date.today() - datetime.timedelta(2 * 365) self.status_date = datetime.date.today() - datetime.timedelta(7) self.target_date = datetime.date.today() - datetime.timedelta(7) self.gap = self.gap_factory.get_green_assessment_property( assessment=self.green_assessment, organization=self.org, user=self.user, with_url=3, metric=5, date=self.start_date, status='Pending', source='Assessor', status_date=self.status_date, version='1', eligibility=True) self.urls = [url.url for url in self.gap.urls.all()]
def setUp(self): self.maxDiff = None user_details = { 'username': '******', 'password': '******', } self.user = User.objects.create_superuser(email='*****@*****.**', **user_details) self.org, _, _ = create_organization(self.user) self.property_view_factory = FakePropertyViewFactory( organization=self.org, user=self.user) self.ga_factory = FakeGreenAssessmentFactory(organization=self.org) self.gap_factory = FakeGreenAssessmentPropertyFactory( organization=self.org, user=self.user) self.assessment = self.ga_factory.get_green_assessment() self.property_view = self.property_view_factory.get_property_view() self.data = { 'source': 'test', 'status': 'complete', 'status_date': '2017-01-01', 'metric': 5, 'version': '0.1', 'date': '2016-01-01', 'eligibility': True, 'assessment': self.assessment, 'view': self.property_view, } self.urls = ['http://example.com', 'http://example.org']
def setUp(self): self.maxDiff = None user_details = { 'username': '******', 'password': '******', } self.user = User.objects.create_superuser(email='*****@*****.**', **user_details) self.org = Organization.objects.create() OrganizationUser.objects.create(user=self.user, organization=self.org) self.audit_log_factory = FakePropertyAuditLogFactory( organization=self.org, user=self.user) self.property_factory = FakePropertyFactory(organization=self.org) self.property_state_factory = FakePropertyStateFactory( organization=self.org) self.property_view_factory = FakePropertyViewFactory( organization=self.org, user=self.user) self.ga_factory = FakeGreenAssessmentFactory(organization=self.org) self.gap_factory = FakeGreenAssessmentPropertyFactory( organization=self.org, user=self.user) self.label_factory = FakeStatusLabelFactory(organization=self.org) self.assessment = self.ga_factory.get_green_assessment() self.property_view = self.property_view_factory.get_property_view() self.gap_data = { 'source': 'test', 'status': 'complete', 'status_date': datetime.date(2017, 0o1, 0o1), 'metric': 5, 'version': '0.1', 'date': datetime.date(2016, 0o1, 0o1), 'eligibility': True, 'assessment': self.assessment, 'view': self.property_view, } self.urls = ['http://example.com', 'http://example.org']
def test_validity_duration_field_to_representation(self): """Test ValidityDurationField.to_representation()""" ga_factory = FakeGreenAssessmentFactory(organization=self.org) green_assessment = ga_factory.get_green_assessment( validity_duration=365) field = ValidityDurationField() result = field.to_representation(green_assessment.validity_duration) self.assertEqual(result, 365)
def setUp(self): self.maxDiff = None user_details = { 'username': '******', 'password': '******', } self.user = User.objects.create_superuser(email='*****@*****.**', **user_details) self.org = Organization.objects.create() OrganizationUser.objects.create(user=self.user, organization=self.org) self.audit_log_factory = FakePropertyAuditLogFactory( organization=self.org, user=self.user) self.cycle_factory = FakeCycleFactory(organization=self.org, user=self.user) self.property_state_factory = FakePropertyStateFactory( organization=self.org) self.property_view_factory = FakePropertyViewFactory( organization=self.org, user=self.user) self.ga_factory = FakeGreenAssessmentFactory(organization=self.org) self.gap_factory = FakeGreenAssessmentPropertyFactory( organization=self.org, user=self.user) self.taxlot_property_factory = FakeTaxLotPropertyFactory( organization=self.org, user=self.user) self.taxlot_state_factory = FakeTaxLotStateFactory( organization=self.org) self.taxlot_view_factory = FakeTaxLotViewFactory(organization=self.org, user=self.user) self.assessment = self.ga_factory.get_green_assessment() self.cycle = self.cycle_factory.get_cycle() self.property_state = self.property_state_factory.get_property_state() self.property_view = self.property_view_factory.get_property_view( state=self.property_state, cycle=self.cycle) self.taxlot_state = self.taxlot_state_factory.get_taxlot_state() self.taxlot_view = self.taxlot_view_factory.get_taxlot_view( state=self.taxlot_state, cycle=self.cycle) self.audit_log = self.audit_log_factory.get_property_audit_log( state=self.property_state, view=self.property_view, record_type=AUDIT_USER_EDIT, description=json.dumps(['a', 'b'])) self.audit_log2 = self.audit_log_factory.get_property_audit_log( view=self.property_view) self.gap_data = { 'source': 'test', 'status': 'complete', 'status_date': datetime.date(2017, 0o1, 0o1), 'metric': 5, 'version': '0.1', 'date': datetime.date(2016, 0o1, 0o1), 'eligibility': True, 'assessment': self.assessment, 'view': self.property_view, } self.urls = ['http://example.com', 'http://example.org'] self.gap = self.gap_factory.get_green_assessment_property( **self.gap_data) self.serializer = PropertyViewAsStateSerializer( instance=self.property_view)
def setUp(self): self.maxDiff = None user_details = { 'username': '******', 'password': '******', } self.user = User.objects.create_superuser(email='*****@*****.**', **user_details) self.org, _, _ = create_organization(self.user) self.ga_factory = FakeGreenAssessmentFactory(organization=self.org) assessment_data = { 'name': 'Test', 'award_body': 'Test Inc', 'recognition_type': 'AWD', 'description': 'Test Award', 'is_numeric_score': True, 'is_integer_score': True, 'validity_duration': 365 } self.assessment = self.ga_factory.get_green_assessment( **assessment_data)