tests for project map config section
This commit is contained in:
parent
2da040547a
commit
dc5dcf0cb1
3 changed files with 27 additions and 12 deletions
4
tests/samples/project_map.cfg
Normal file
4
tests/samples/project_map.cfg
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
[settings]
|
||||||
|
debug = false
|
||||||
|
api_key = 1234
|
||||||
|
[projectmap]
|
|
@ -94,3 +94,24 @@ class LanguagesTestCase(utils.TestCase):
|
||||||
execute(args)
|
execute(args)
|
||||||
|
|
||||||
self.assertEquals('svn', self.patched['wakatime.offlinequeue.Queue.push'].call_args[0][0]['project'])
|
self.assertEquals('svn', self.patched['wakatime.offlinequeue.Queue.push'].call_args[0][0]['project'])
|
||||||
|
|
||||||
|
def test_project_map(self):
|
||||||
|
response = Response()
|
||||||
|
response.status_code = 0
|
||||||
|
self.patched['wakatime.packages.requests.adapters.HTTPAdapter.send'].return_value = response
|
||||||
|
|
||||||
|
with tempfile.NamedTemporaryFile() as fh:
|
||||||
|
now = u(int(time.time()))
|
||||||
|
entity = 'tests/samples/projects/project_map/emptyfile.txt'
|
||||||
|
|
||||||
|
fh.write(open('tests/samples/project_map.cfg').read())
|
||||||
|
fh.write('{0} = proj-map'.format(os.path.realpath(os.path.dirname(entity))))
|
||||||
|
fh.flush()
|
||||||
|
|
||||||
|
config = fh.name
|
||||||
|
|
||||||
|
args = ['--file', entity, '--config', config, '--time', now]
|
||||||
|
|
||||||
|
execute(args)
|
||||||
|
|
||||||
|
self.assertEquals('proj-map', self.patched['wakatime.offlinequeue.Queue.push'].call_args[0][0]['project'])
|
||||||
|
|
|
@ -25,22 +25,12 @@ class BaseProject(object):
|
||||||
self.path = path
|
self.path = path
|
||||||
self._configs = configs
|
self._configs = configs
|
||||||
|
|
||||||
def project_type(self):
|
|
||||||
""" Returns None if this is the base class.
|
|
||||||
Returns the type of project if this is a
|
|
||||||
valid project.
|
|
||||||
"""
|
|
||||||
project_type = self.__class__.__name__.lower()
|
|
||||||
if project_type == 'baseproject':
|
|
||||||
project_type = None
|
|
||||||
return project_type
|
|
||||||
|
|
||||||
def process(self):
|
def process(self):
|
||||||
""" Processes self.path into a project and
|
""" Processes self.path into a project and
|
||||||
returns True if project is valid, otherwise
|
returns True if project is valid, otherwise
|
||||||
returns False.
|
returns False.
|
||||||
"""
|
"""
|
||||||
return False
|
return False # pragma: nocover
|
||||||
|
|
||||||
def name(self):
|
def name(self):
|
||||||
""" Returns the project's name.
|
""" Returns the project's name.
|
||||||
|
@ -50,4 +40,4 @@ class BaseProject(object):
|
||||||
def branch(self):
|
def branch(self):
|
||||||
""" Returns the current branch.
|
""" Returns the current branch.
|
||||||
"""
|
"""
|
||||||
return None
|
return None # pragma: nocover
|
||||||
|
|
Loading…
Reference in a new issue