Exemplo n.º 1
0
 def test_get_coordinates(self):
     """Get location from redis"""
     self.r.lpush('BOT_STATUS.location', self.coordinates[2])
     self.r.lpush('BOT_STATUS.location', self.coordinates[1])
     self.r.lpush('BOT_STATUS.location', self.coordinates[0])
     self.assertEqual(ENV.redis_load('location', other_redis=self.r),
                      self.coordinates)
Exemplo n.º 2
0
 def getcoordinates(self, test_coordinates=False):
     """Get machine coordinates from bot."""
     location = ENV.redis_load('location')
     if location is None or test_coordinates:
         self.coordinates = self.test_coordinates  # testing coordintes
     else:
         self.coordinates = location  # current bot coordinates
Exemplo n.º 3
0
 def test_env_load(self):
     """Get user_env from redis"""
     self.r.set('BOT_STATUS.user_env.testkey', self.testvalue)
     self.assertEqual(
         ENV.redis_load('user_env',
                        name='testkey',
                        get_json=False,
                        other_redis=self.r), self.testvalue)
Exemplo n.º 4
0
 def test_none_user_env_load(self):
     """Try to get a non-existant user_env from redis"""
     self.assertEqual(
         ENV.redis_load('user_env', name='doesntexist', other_redis=self.r),
         None)
Exemplo n.º 5
0
 def test_bad_json_env_load(self):
     """Try to get bad json user_env from redis"""
     self.r.set('BOT_STATUS.user_env.testdata', self.badjson_string)
     self.assertEqual(
         ENV.redis_load('user_env', name='testdata', other_redis=self.r),
         None)
Exemplo n.º 6
0
 def test_json_env_load(self):
     """Get json user_env from redis"""
     self.r.set('BOT_STATUS.user_env.testdata', json.dumps(self.testjson))
     self.assertEqual(
         ENV.redis_load('user_env', name='testdata', other_redis=self.r),
         self.testjson)
Exemplo n.º 7
0
 def test_not_coordinates(self):
     """Coordinates aren't a list"""
     self.r.set('BOT_STATUS.location', 'notalist')
     self.assertEqual(ENV.redis_load('location', other_redis=self.r), None)
Exemplo n.º 8
0
 def test_no_coordinates(self):
     """Coordinates don't exist"""
     self.assertEqual(ENV.redis_load('location', other_redis=self.r), None)