Esempio n. 1
0
 def test_filtered_ordered_query_filter_no_field(self):
     # Create OsProfile
     os_profile = OsProfile()
     os_profile.set_resourceId('resourceId')
     os_profile.set_osName('Linux')
     self.db_session.merge(os_profile)
     self.db_session.flush()
     self.db_session.expunge_all()
     # Query with invalidFilterField
     filters = {'invalidFilterField': 'SomeValue'}
     query = healthnmon_alchemy_api._create_filtered_ordered_query(
         self.db_session, OsProfile, filters=filters)
     os_profiles = query.all()
     self.assert_(os_profiles is not None)
     self.assert_(len(os_profiles) == 1)
     self.assert_(os_profiles[0] is not None)
     self.assert_(os_profiles[0].osName == os_profile.osName)
Esempio n. 2
0
 def test_filtered_ordered_query_deleted_no_field(self):
     # Create OsProfile which do not have deleted field
     os_profile = OsProfile()
     os_profile.set_resourceId('resourceId')
     os_profile.set_osName('Linux')
     self.db_session.merge(os_profile)
     self.db_session.flush()
     self.db_session.expunge_all()
     # Query with deleted
     filters = {'deleted': False}
     query = healthnmon_alchemy_api._create_filtered_ordered_query(
         self.db_session, OsProfile, filters=filters)
     os_profiles = query.all()
     self.assert_(os_profiles is not None)
     self.assert_(len(os_profiles) == 1)
     self.assert_(os_profiles[0] is not None)
     self.assert_(os_profiles[0].osName == os_profile.osName)
Esempio n. 3
0
 def test_filtered_ordered_query_filter_no_field(self):
     # Create OsProfile
     os_profile = OsProfile()
     os_profile.set_resourceId('resourceId')
     os_profile.set_osName('Linux')
     self.db_session.merge(os_profile)
     self.db_session.flush()
     self.db_session.expunge_all()
     # Query with invalidFilterField
     filters = {'invalidFilterField': 'SomeValue'}
     query = healthnmon_alchemy_api._create_filtered_ordered_query(
         self.db_session, OsProfile, filters=filters)
     os_profiles = query.all()
     self.assert_(os_profiles is not None)
     self.assert_(len(os_profiles) == 1)
     self.assert_(os_profiles[0] is not None)
     self.assert_(os_profiles[0].osName == os_profile.osName)
Esempio n. 4
0
 def test_filtered_ordered_query_deleted_no_field(self):
     # Create OsProfile which do not have deleted field
     os_profile = OsProfile()
     os_profile.set_resourceId('resourceId')
     os_profile.set_osName('Linux')
     self.db_session.merge(os_profile)
     self.db_session.flush()
     self.db_session.expunge_all()
     # Query with deleted
     filters = {'deleted': False}
     query = healthnmon_alchemy_api._create_filtered_ordered_query(
         self.db_session, OsProfile, filters=filters)
     os_profiles = query.all()
     self.assert_(os_profiles is not None)
     self.assert_(len(os_profiles) == 1)
     self.assert_(os_profiles[0] is not None)
     self.assert_(os_profiles[0].osName == os_profile.osName)
Esempio n. 5
0
 def test_filtered_ordered_query_changessince_no_field(self):
     # Create OsProfile which do not have lastModifiedEpoch field
     os_profile = OsProfile()
     os_profile.set_resourceId('resourceId')
     os_profile.set_osName('Linux')
     self.db_session.merge(os_profile)
     self.db_session.flush()
     self.db_session.expunge_all()
     # Query with changes-since
     now = long(time.time() * 1000L)
     filters = {'changes-since': now}
     query = healthnmon_alchemy_api._create_filtered_ordered_query(
         self.db_session, OsProfile, filters=filters)
     os_profiles = query.all()
     self.assert_(os_profiles is not None)
     self.assert_(len(os_profiles) == 1)
     self.assert_(os_profiles[0] is not None)
     self.assert_(os_profiles[0].osName == os_profile.osName)
Esempio n. 6
0
 def test_filtered_ordered_query_changessince_no_field(self):
     # Create OsProfile which do not have lastModifiedEpoch field
     os_profile = OsProfile()
     os_profile.set_resourceId('resourceId')
     os_profile.set_osName('Linux')
     self.db_session.merge(os_profile)
     self.db_session.flush()
     self.db_session.expunge_all()
     # Query with changes-since
     now = long(time.time() * 1000L)
     filters = {'changes-since': now}
     query = healthnmon_alchemy_api._create_filtered_ordered_query(
         self.db_session, OsProfile, filters=filters)
     os_profiles = query.all()
     self.assert_(os_profiles is not None)
     self.assert_(len(os_profiles) == 1)
     self.assert_(os_profiles[0] is not None)
     self.assert_(os_profiles[0].osName == os_profile.osName)